#ifndef INCLUDED_GLTOOLS_H
#define INCLUDED_GLTOOLS_H

#include "gl.h"

#ifdef __cplusplus
extern "C" {
#endif

/*
 * split_shader()
 *
 * the shader source contains a vertex shader and fragment shader in a single string 'shader_source', and
 * seperated by a single line containing '%%'. This function splits the shader_source string into two seperate
 * strings containing the vertex and fragment shader. If one or both of the shaders are not found, the pointer
 * in question points to a nullbyte.
 *
 * The return value is nonzero on error. vertex_shader and fragment_shader point to *inside* the shader_source
 * pointer. the %% line is overwritten with 0-bytes to make the vertex_shader point to a zero-terminated string.
 *
 *   // This is the vertex shader
 *   int main() { ... }
 *   %%
 *   // This is the fragment shader
 *   int main() { ... }
 *
 */
int split_shader(char* shader_source, char** vertex_shader, char** fragment_shader);

/*
 * is_extension_supported()
 *
 * The recommended technique for querying OpenGL extensions;
 * from http://opengl.org/resources/features/OGLextensions/
 */
int is_extension_supported(const char *extension);

/*
 * info_log()
 *
 * Returns the info log for an OpenGL handler after compiling/linking (shader,program)
 */
char* info_log(GLhandleARB obj);


#ifdef __cplusplus
}
#endif
#endif /* INCLUDED_GLTOOLS_H */

